package com.yuer.spi.filter;

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;

@Activate(group = CommonConstants.CONSUMER)
public class TimeCountFilter implements Filter{
    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation)  {
        long startTimer =  System.currentTimeMillis();

//        try {
//            return  invoker.invoke(invocation);
//        }finally {
//            long endTimer= System.currentTimeMillis();
//            long poird = endTimer - startTimer;
//            System.out.println(String.format("消耗了%d毫秒",poird));
//        }
        return invoker.invoke(invocation);
    }
}
